<?php
/**
* @version		$Id: view.html.php 179009349 2011-07-20 00:48:06 dothithoit06@gmail.com $
* @package		Joomla 1.5.x
* @subpackage	Htbn_don_nhap_khos
* @copyright	Copyright (C) 2010 - 2011 Open Source Matters. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );

jimport( 'joomla.application.component.view');

/**
 * HTML View class for the Htbn_don_nhap_khos component
 *
 * @static
 * @package		Joomla 1.5.x
 * @subpackage	Htbn_don_nhap_khos
 */
class Htbn_don_nhap_khosViewHtbn_don_nhap_khos extends JView
{
	function display($tpl = null)
	{
		global $mainframe, $option;

		$db		=& JFactory::getDBO();
		$uri	=& JFactory::getURI();
		
		JHTML::_('behavior.modal', 'a.modal-button');

		$filter_state		= $mainframe->getUserStateFromRequest( $option.'filter_state',		'filter_state',		'',				'word' );
		$filter_order		= $mainframe->getUserStateFromRequest( $option.'filter_order',		'filter_order',		'a.ordering',	'cmd' );
		$filter_order_Dir	= $mainframe->getUserStateFromRequest( $option.'filter_order_Dir',	'filter_order_Dir',	'',				'word' );
		$filter_date		= $mainframe->getUserStateFromRequest( $option.'filter_date',		'filter_date',		'',				'string' );
		$search				= $mainframe->getUserStateFromRequest( $option.'search',			'search',			'',				'string' );
		$search				= JString::strtolower( $search );

		// Get data from the model
		$items		= & $this->get( 'Data');
		$total		= & $this->get( 'Total');
		$pagination = & $this->get( 'Pagination' );

		// state filter
		$lists['state']	= JHTML::_('grid.state',  $filter_state );

		// date filter
		$d = $filter_date ? JHTML::_('date', $filter_date, '%Y-%m-%d') : '';
		$lists['filter_date']	= JHTML::_('calendar', $d, 'filter_date', 'filter_date', "%Y-%m-%d", array('onchange'=>'document.adminForm.submit();'));

		// table ordering
		$lists['order_Dir'] = $filter_order_Dir;
		$lists['order'] = $filter_order;
		
		// search filter
		$lists['search']= $search;

		$this->assignRef('lists',		$lists);
		$this->assignRef('items',		$items);
		$this->assignRef('pagination',	$pagination);
		$this->assign('action', $uri->toString());
		
		$paramfile 	= JPath::clean(JPATH_COMPONENT.'/views/htbn_don_nhap_kho/params.xml');
		$params = new JParameter(NULL, $paramfile);
		$this->assignRef('params', $params);

		parent::display($tpl);
	}
}